package com.lc.entity;

import com.cnpc.framework.annotation.Header;
import com.cnpc.framework.utils.DateUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author  Nomaj
 * @Date 2022-03-10
 */

@Setter
@Getter
@ToString
@Entity
@Table ( name ="app_user" )
public class AppUser implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Long id;

	/**
	 * 创建时间
	 */
   	@Column(name = "createtime" )
	private String createtime;

	/**
	 * 更新时间
	 */
   	@Column(name = "updatetime" )
	private String updatetime;

   	@Column(name = "username" )
	private String username;

   	@Column(name = "mobile" )
	private String mobile;


	@Column(name = "deptName" )
	private String deptName;


	@Column(name = "deptId" )
	private String deptId;

   	@Column(name = "state" )
	private int state;

   	@Column(name = "remark" )
	private String remark;

	@Header(name = "token")
	@Column(name = "token")
	private String token;

	@Header(name = "token有效期")
	@Column(name = "tokenLimit")
	private String tokenLimit;

	@Header(name = "企业类型")
	@Column(name = "type")
	private String type;

	public void setDefaultTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		createtime = dateTime;
		updatetime = dateTime;
	}

	public void setDefaultCreateTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		createtime = dateTime;
	}

	public void setDefaultUpdateTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		updatetime = dateTime;
	}

}
